<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>   
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>
  <head>
    <base href="<%=basePath%>">  
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="js/jquery-1.8.0.js"></script>
	<link rel="stylesheet" type="text/css" href="css/validate.css"  ></link> 
	<link rel="stylesheet" type="text/css" href="css/maintable.css" ></link>
		<style type="text/css">
			#adminName{
				width:200px;/* 来设定用户账号那一栏固定长度 */
			}
		</style>
		<script>
			
			function bianYe(pageIndex){
				document.form1.action="RoleServlet.do?pageIndex=" + pageIndex;
				document.form1.submit();
			}
			
			function zhuanYe(){
				var pageIndex=document.getElementById("pageIndex").value;
				bianYe(pageIndex);
			}
		</script>
  </head>
  
  <body>
  		<div class ="div_title">
			<div class="div_titlename"> <img src="images/san_jiao.gif" ><span>用户角色管理</span></div>
			<div class="div_titleoper">
			</div>
		</div>
				 
		 <form action="RoleServlet.do"  name="form1" method="post">
			 <input type="hidden" name="flag" value="listadmin">
			 <table class="main_table" >
			       <tr>
		 					<th id="adminName">账号</th><th>状态</th>	<th>用户角色</th>  <th>最后更新日期</th> 	<th>操作</th>
			 		</tr>
			 		<c:forEach var="admin" items="${ adminList}">
			 			<tr>
			 				<td id="adminName" >${admin.adminName }</td>
			 				<td>
			 					<c:if test="${admin.state==2 }">已锁定</c:if>
			 				</td>
			 				<td ><a title="${admin.note }" class="note_a">${admin.note }</a></td>
			 				<td><fmt:formatDate value="${admin.editDate }" pattern="yyyy年MM月dd日"/></td>
			 				<td>
			 					<c:if test="${admin.state!=2 }"><a href="RoleServlet.do?flag=jueSeFenPei&id=${admin.id }">角色分配</a></c:if>
			 					
				 			</td>
			 			</tr>
			 		</c:forEach>
			</table>
			</form>
			
			<div class="div_page" >
				  <div class="div_page_left">    共有 <label>${pageInfo.rowCount }</label> 条记录，当前第 <label>${pageInfo.pageIndex }</label> 页，共 <label>${pageInfo.pageCount }</label> 页	</div>		
				  <div class="div_page_right" > 	 
				  		<c:choose>
					  		<c:when test="${pageInfo.hasPre }">
					  			<input type="submit" value="首页" onclick="bianYe(1)"/>
					  			<input type="submit" value="上一页" onclick="bianYe(${pageInfo.pageIndex-1 })"/>
					  			
					  		</c:when>
					  		<c:otherwise>
					  			首页  上一页
					  		</c:otherwise>
					  	</c:choose>
					  	<c:choose>
					  		<c:when test="${pageInfo.hasNext }">
					  			<input type="submit" value="下一页" onclick="bianYe(${pageInfo.pageIndex+1 })"/>
					  			<input type="submit" value="尾页" onclick="bianYe(${pageInfo.pageCount })"/>
					  		</c:when>
					  		<c:otherwise>
					  			下一页 尾页
					  		</c:otherwise>
					  	</c:choose>
						<input type="submit" value="转到" onclick="zhuanYe()">
				  		<input type="text" name="pageIndex" id="pageIndex" name="pageIndex" value="${pageInfo.pageIndex }" /> 页
				  	
				   </div>
		  </div>
  </body>
</html>